import http from "../../../utils/http";
import {Api} from "../../../utils/api";

Page({
    data: {
        materialInfo: {
            id: 0,
        },
        linkList: []
    },
    onLoad: function (options) {
        const id = options.id
        this.setData({'materialInfo.id': id})
    },
    onShow() {
        this.getMaterialInfo()
    },
    getMaterialInfo() {
        const id = this.data.materialInfo.id
        http.getRequest(Api.getMaterialInfo, {id}, (res) => {
            const linkList = res.data.linkList
            const materialInfo = res.data
            delete materialInfo.linkList
            this.setData({materialInfo, linkList})
        })
    },
});
